<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  provide(){ //提供
      return {
        reload: this.reload
      }
    },
  mounted() {
    this.$router.beforeEach((to, from, next) => {
      if (to.matched.some(record => record.meta.admin)) {
        let session = window.localStorage;
        let login = JSON.parse(session.getItem("login"));
        if (login!=null&&login.email == "1335189318@qq.com") {
          console.log(1);
          next();
        } else {
          alert("博主才可以发表文章")
          next({
            path:'/'
          })
        }
      } else {
        next();
      }
    });
  }
};
</script>

<style>
/* #app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
} */
</style>
